package com.itheima.health.dao;

import com.itheima.health.pojo.Role;
import com.itheima.health.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Set;

/**
 * @author ：zhang
 * @date ：Created in 2019/11/20
 * @description ：用户DAO
 * @version: 1.0
 */
@Mapper
public interface UserDao {

    /**
     * 根据userName查询
     * @param username
     * @return
     */
    User selectByUsername(@Param("username") String username);

    @Select("select tr.keyword from t_user user inner join t_user_role user_role on user.id = user_role.user_id " +
            "inner join t_role tr on user_role.role_id = tr.id where user.username = #{username}")
    Set<Role> selectByUserRoleKeyWordByUsername(@Param("username") String username);


}
